#!/bin/bash
#function: set mysqld 5.6 password and start mysqld 5.6
#parmeter:
#author: yeslf
#version: 1.0
#Test: CentOS6


/usr/bin/mysql_install_db  --user=mysql   --basedir=/usr --datadir=/var/lib/mysql

service mysql start
mysql -u root -e "CREATE USER 'mysqlroot'@'%' IDENTIFIED BY 'test123'"
mysql -u root -e "CREATE USER 'mysqlroot'@'localhost' IDENTIFIED BY 'test123'"
mysql -u root -e "CREATE USER 'mysqlroot'@'127.0.0.1' IDENTIFIED BY 'test123'"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'mysqlroot'@'%' WITH GRANT OPTION"

service mysql stop 

chown -R mysql:mysql /var/lib/mysql

mysqld_safe 


